package com.lahui.splitpack

import android.content.pm.PackageManager
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.text.TextUtils
import android.util.Log
import kotlin.math.log

class MainActivity : AppCompatActivity() {
    private val TAG = "GET_META"
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        Log.d(TAG, "GameId = ${getGameId()}")
        Log.d(TAG, "ChannelId = ${getChannelId()}")
        Log.d(TAG, "ChannelName = ${getChannelName()}")

    }


    fun getGameId(): Int {
        val applicationInfo =
            packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA)
        val gameId = applicationInfo.metaData.getInt("game_id")
        return gameId
    }

    fun getChannelId(): Int {
        val applicationInfo =
            packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA)
        val channelId = applicationInfo.metaData.getInt("channel_id")
        return channelId
    }

    fun getChannelName(): String {
        val applicationInfo =
            packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA)
        val channelName = applicationInfo.metaData.getString("channel_name")
        return channelName!!
    }


}